﻿
@{
    ViewBag.Title = "MonthlyProfit";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<div class="rows">
    <div class="panel panel-default">
        <table class="form">
            <tr>
                <th class="formTitle">收费开始日期：</th>
                <td class="formValue">
                    <input id="kssj" type="text" class="form-control input-wdatepicker form-an"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" value="@(DateTime.Now.ToString("yyyy-MM-01"))" />
                </td>
                <th class="formTitle">结束日期：</th>
                <td class="formValue">
                    <input id="jssj" type="text" class="form-control input-wdatepicker form-an"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" value="@(DateTime.Now.ToString("yyyy-MM-dd"))" />
                </td>
                <th class="formTitle">类型：</th>
                <td class="formValue">
                    <select id="type" name="type" class="form-control form-an">
                        <option value="">==请选择==</option>
                        <option value="outpatient">门诊</option>
                        <option value="inpatient">住院</option>
                    </select>
                </td>
                <th class="formTitle"></th>
                <td class="formValue"></td>
                <td class="formValue" style="padding-left:20px;">
                    <input type="button" id="btn_search" onclick="submit();" class="btn btn-primary btn-md" value="查询" style="width:55px" />
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="ui-layout" id="layout" style="height:100%;width:100%;">
    <iframe class="ui-layout-center" style="width:100%;" id="iframerightiframerightiframerightttt" name="iframerightiframerightiframerightttt"
            scrolling="auto" allowtransparency="true" frameborder="0"></iframe>
</div>
<script type="text/javascript">
    var reportServerHOST = '@(ViewBag.ReportServerHOST)';
    var orgId = '@(ViewBag.OrgId)';
    var isHospAdministrator = '@(ViewBag.IsHospAdministrator)';
    var curUserCode = '@(ViewBag.CurUserCode)';
    var uri = '/ReportServer/Pages/ReportViewer.aspx?%2FHIS.Report.1%2F%E6%9C%88%E5%BA%A6%E6%94%B6%E5%85%A5%E6%8A%A5%E8%A1%A8&rs:Command=Render';
    function search() {
        submit();
    }
    function submit() {
        if ($('#kssj').val().length == 0) {
            $.modalAlert("缺少开始时间", "error");
            return;
        }
        if ($('#jssj').val().length == 0) {
            $.modalAlert("缺少结束时间", "error");
            return;
        }
        if ($('#kssj').val() > $('#jssj').val()) {
            $.modalAlert("开始时间不能大于结束时间", "error");
            return;
        }

        var url = getUrl();
        url += "&kssj=" + $('#kssj').val();
        url += "&jssj=" + $('#jssj').val();
        url += "&type=" + ($('#type').val() == null ? "" : $('#type').val());

        setTimeout("$.loading(true, '正在请求报表页面...');", 10);
        $("#iframerightiframerightiframerightttt").attr('src', url);
    }

    $("#iframerightiframerightiframerightttt").load(function () {
        $.loading(false);
    });

    $(function () {
        var h = $(window).height() - 55
        $('#layout iframe').css('height', h);

        //治疗项目选择浮层绑定
        $('#blh').newtouchBatchFloatingSelector({
            width: 500,
            height: 200,
            caption: "选择患者",
            clickautotrigger: true,
            url: "/PatientManage/HospiterRes/PatSearchInfo",
            ajaxparameters: function ($thisinput) {
                var keyword = $thisinput.val().trim();
                var orgId = $("#OrganizeId").val();
                return "keyword=" + keyword + "&orgId=" + orgId;
            },
            itemdbclickhandler: function ($thistr, $thisinput) {
                if (!!$thistr.attr('data-patid')) {
                    $("#blh").val($thistr.attr('data-blh'));
                    $("#blh").attr("data-label", $thistr.attr('data-patid'));
                }
            },
            colModel: [
                 { label: '主键', name: 'patid', hidden: true },
                 { label: '病历号', name: 'blh', width: 100, align: 'left' },
                 { label: '姓名', name: 'xm', width: 120, align: 'left' },
                 { label: '出生年月', name: 'csny', hidden: true, width: 100, align: 'left' },
                 {
                     label: '性别', name: 'xb', width:70, align: 'left', formatter: function (cellvalue) {
                         return $.getGender(cellvalue);
                     }
                 },
                    {
                        label: '年龄', name: 'nlshow', width: 100, align: 'left', formatter: function (cellvalue, a, b) {
                            return getAgeFromBirthTime({ begin: b.csny }).text;
                        }
                    },
                 { label: 'brly', name: 'brly', align: 'left', hidden: true },
                 { label: 'zjh', name: 'zjh', align: 'left', hidden: true },
                 { label: 'kh', name: 'kh', align: 'left', hidden: true },
                 { label: 'phone', name: 'phone', align: 'left', hidden: true },
                 { label: 'dy', name: 'dy', align: 'left', hidden: true },
                 { label: 'zjlx', name: 'zjlx', align: 'left', hidden: true },
                 { label: 'sycs', name: 'sycs', align: 'left', hidden: true },
                 { label: 'dybh', name: 'dybh', align: 'left', hidden: true }
            ]
        });
        setTimeout(function () { submit(); }, 100);
    });

    function getUrl() {
        if (uri.StartWith('/')) {
            uri = uri.substr(1);
        }
        var srcUrl = uri;
        srcUrl = reportServerHOST + srcUrl;
        //获取自定义样式
        if (srcUrl.indexOf('&rc:') === -1) {
            srcUrl += "&rc:Stylesheet=MyStyleSheet";
        }
        if (srcUrl.indexOf('&rs:') === -1) {
            srcUrl += "&rs:";
        }
        else {
            srcUrl += "&";
        }
        srcUrl += "orgId=";
        srcUrl += orgId;
        return srcUrl;
    }

</script>
<script type="text/javascript">
    function funcOrganizeIdChange() {
        $("#blh").val('');
        orgId = $("#OrganizeId").val();
        //submit();
    }
</script>
@Html.Partial("_ReportOrganizeIdDDLSearchView")